function Question_Code() {
	var buffer = new StringBuffer();
	buffer.append('<div id="find" class="finds2"><div class="searchinput ui-border-radius"><input id="keyword" class="bordersolid" type="text" value="" onblur="Show_Search()" onkeyup="Question_Search();"/><div id="searchicon" class="searchicon"><img src="img/jing.jpg"/></div><div id="searchicons" class="searchicons"><img src="img/jings.jpg"/></div></div></div>');
	buffer.append('<div class="horizen border-bottom"></div>');
	return buffer.toString();
};

function Question_Data(data) {
	var buffer = new StringBuffer();
	$(data).each(function(i,info){
		buffer.append('<div class="customerlist border-bottom" id="'+info.ID+'"><div class="customername">'+info.ID+".&nbsp;"+info.Title+'</div><div class="customerinfo" style="font-size:12px;">'+info.Context+'</div></div>');
	});
	return buffer.toString();
};

function Receive_Question(pageindex)
{
	var data = {};
			data.act = "Find_Question";
			data.userid=userid;
			data.comid=comid;
			data.pageindex=pageindex;
			data.pagesize=PAGE_SIZE20;
			data.keyword = $("#keyword").val();
			data.sign=GetSign(data.act);
			
			mui.getJSON(index_domain, data, function(json) {
				if(json.data.length>0)
				{
					if(pageindex==1)
					{
						$("#contentlist1").html(Question_Data(json.data));
					}else{
						$("#contentlist1").append(Question_Data(json.data));
					}
					setTimeout(function(){
						Init_Question();
						myScroll1.refresh();
					},500); //需要延迟500毫秒加载，否则当数量少时不能下拉
					if(json.data.length!=data.pagesize)
					{
						$("#loading1").html("");
					}else{
						$("#loading1").html('<img src="img/loading.gif"/>');
					}
				}else
				{
					
					if(pageindex==1)
					{
						$("#contentlist1").html("");
						$("#loading1").html("主人，没有找到您需要的数据"); 
					}
					else
					{
						$("#loading1").html("没有更多了");
					}
				}
				
         		pageindex = parseInt($("#divmsg1").attr("pageindex"))+1;
         		$("#divmsg1").attr("pageindex",pageindex);
			});
};

function Question_Search(){
	Receive_Question(1);
};

function Init_Question()
{
	mui("#contentlist1").off("tap",".customerlist");
	mui("#contentlist1").on("tap",".customerlist",function(){
		OpenWindow2(2,"问题详情","",function(){
		});
		obj=$(this);
		$("#contentlist2").html(QuestionInfo_Code(obj.find(".customername").html(),obj.find(".customerinfo").html()));
	});
};


function QuestionInfo_Code(title,context){
	var buffer = new StringBuffer();
	buffer.append('<div class="qtitle">'+title+'</div>');
	buffer.append('<div class="qcontext">'+context+'</div>');
	return buffer.toString();
};

function Suggest_Code() {
	var buffer = new StringBuffer();
	buffer.append('<div class="notepaddetail"><textarea placeholder="主人，请在这里写下您对我们产品的建议，我们一定认真采纳"></textarea></div>');
	return buffer.toString();
};

function Save_Suggest(){
	var data = {};
			data.act = "Save_Suggest";
			data.userid=userid;
			data.comid=comid;
			data.source=source;
			data.version=version;
			data.context=$("#contentlist2 textarea").val();
			if(data.context.Trim()=="")
			{
				plus.nativeUI.toast("请输入您的宝贵意见");
				return;
			}
			data.sign=GetSign(data.act);
			plus.nativeUI.showWaiting( "正在保存..." );
			
			mui.getJSON(index_domain, data, function(json) {
				plus.nativeUI.toast(json.msg);
				plus.nativeUI.closeWaiting();
				if(json.state){
					CloseWindow();
				}
			});
};
